import Storage from '@/framework/cache/storage'




// API 基础路径
global.API_BASE_PATH = '//oss.xmappservice.com'
global.API_VERSION = "";




// 应用名称
global.APP_NAME = "English"

// 应用ID
global.APP_ID = 'english';


// 应用标题
global.APP_TITLE = " 英语"

// 加密秘钥
global.APP_SECRET_KEY = ""

// 分页大小
global.PAGE_SIZE = 20

//主题颜色
global.PRIMARY_COLOR = '#FC3752'

// 取消
global.CANCEL_COLOR = '#999999'




/**
 * 数组去重
 */
 global.unique = function(arr, ... keys){
	if(keys.length == 0){
		keys = ['id'];
	}
	let exists = new Set();
	
	let result = arr.reduce(function(dist, item){
		
		let karr = [];
		keys.forEach(k =>{
			karr.push(item[k]);
		});
		let kstr = karr.join("#\n#");
		if(!exists.has(kstr)){
			dist.push(item);
			exists.add(kstr);
		}
		return dist;
	}, [])
	
	return result;
}

// 模型本地缓存
const CURRENT_MODEL_KEY = 'CURRENT_MODEL';
global.setModel = (model) => {
  Storage.set(CURRENT_MODEL_KEY, model);
}

global.getModel = () => {
  return Storage.get(CURRENT_MODEL_KEY);
}


export default {}
